package com.first.order.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.first.common.pojo.EduCourse;
import com.first.order.dao.EduCourseDao;
import com.first.order.service.EduCourseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import java.util.List;

/**
 * @program: SecondProject
 * @description:
 * @author: 李榕轩
 * @create: 2023-05-27 16:23
 **/
@Service
public class EduCourseServiceImpl implements EduCourseService {
    @Autowired
    private EduCourseDao eduCourseDao;

    @Override
    public List<EduCourse> queryAllCourse(String courseId) {

        QueryWrapper<EduCourse> wrapper = new QueryWrapper<>();
        if (StringUtils.hasText(courseId)) {
            wrapper.eq("id", courseId);
        }

        List<EduCourse> courses = eduCourseDao.selectList(wrapper);
        return courses;
    }

    @Override
    public EduCourse selectCourseAndTeacherName(String id) {
        return eduCourseDao.selectOneById(id);
    }

    @Override
    public Integer queryAllById(String paramsId, String mobileId) {
        return eduCourseDao.queryAllById(paramsId,mobileId);
    }

}
